$(function(){
	var fckeditor=new FCKeditor('content');
	fckeditor.BasePath= getRootPath() + "/fckeditor/";//相对路径，相对于当前页面
	fckeditor.ToolbarSet="mgTool";
	fckeditor.Width="100%";
	fckeditor.Height="400";
	fckeditor.ReplaceTextarea();
	document.all.content.value="";
	
	/*var sortId = ${sort.sortId};
	alert("sortId");
	$("#select1 option[value=sortId]").attr("selected",true);*/
	
	$("#write_news_form").validate({
		rules:{
			newsTitle:{
						required:true,
						maxlength:16
			},	
			content:{
						maxlength:3000
			}
		},
		messages:{
			newsTitle:{
						required:"您的标题不能为空",
						maxlength:"您的标题长度不能大于16"
			},
			content:{
						maxlength:"您的内容不能大于3000"
			},
		}
	})
	
})
function checkForm(){
	var newsTitle = $("#newsTitle").val();
	if($(".emptySort").val()=="1")
	{
		var oEditor = FCKeditorAPI.GetInstance('content');  
		editorValue = oEditor.GetHTML();
		if(editorValue != "" && editorValue != "&nbsp;" && editorValue != "<br />"){
			if(newsTitle.length>0&&newsTitle.length<17){
				alert("添加成功");
				return true;
			}
			else{
				alert("标题不符合要求！");
				return false;
			}
		}else{
			alert("内容不能为空");
			return false;
		}
	}
	else{
		alert("请先新建分类！");
		return false;
	}
}
function updateF(){
	var newsTitle = $("#newsTitle").val();
	var oEditor = FCKeditorAPI.GetInstance('content');  
	editorValue = oEditor.GetHTML();
	if(editorValue != "" && editorValue != "&nbsp;" && editorValue != "<br />"){
		if(newsTitle.length>0&&newsTitle.length<17){
			alert("添加成功");
			return true;
		}
		else{
			alert("标题不符合要求！");
			return false;
		}
	}
	else{
		alert("内容不能为空");
		return false;
	}
}